<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/5/20 0020
 * Time: 下午 2:41
 */
namespace app\model;
class UserResumeEdu extends \think\Model{
    public $table="user_resume_edu";

    function add_edu($arr){
        $arr['created_at']=cur_time();
       return $this->insert($arr,false,true);
    }

    function update_edu($arr,$id){
        $arr['updated_at']=cur_time();
        unset($arr['id']);
        return $this->where(['id'=>$id])->update($arr);
    }

    function del_edu($id){
        return $this->where(['id'=>$id])->delete();
    }

    function get_arrs_by_user_id($user_id){
        $o=$this->where(['user_id'=>$user_id])->select();
        $arrs=object2array($o);
        foreach($arrs as $k=>$v){
            $arrs[$k]['edu_type_name']=config("web.edu_type")[$v['edu_type']];
        }
        return $arrs;
    }


    function get_edu($id){
        $o=$this->where(['id'=>$id])->find();
        return object2array($o);
    }
}